/*
 * @Author: 15097322811 1447934599@qq.com
 * @Date: 2024-01-11 10:14:46
 * @LastEditors: 15097322811 1447934599@qq.com
 * @LastEditTime: 2024-01-16 19:15:33
 * @Description:
 */
const platform = uni.getSystemInfoSync().platform;
const screenWitdh = uni.getSystemInfoSync().screenWidth;
const screenHeight = uni.getSystemInfoSync().screenHeight;

function platformVal(androidVal, iosVal) {
  return "android" == platform ? androidVal : "ios" == platform ? iosVal : "";
}

function calculateViewWidth(marginLeft, marginRight) {
  return screenWitdh - marginLeft - marginRight;
}

function calculateAndroidViewWidth(marginLeft, marginRight) {
  return screenH - marginLeft - marginRight;
}

function calculateViewX(superViewWidth, width, marginRight) {
  console.log(superViewWidth);
  console.log(superViewWidth - marginRight - width);
  return superViewWidth - marginRight - width;
}

function buildFullscreen() {
  const unit = parseInt((plus.screen.resolutionHeight - 80) / 20);
  const logoTop = String(unit * 1 - 5);
  const sloganTop = String(unit * 5);
  const numberTop = String(unit * 6 + 20);
  const loginBtnTop = String(unit * 9);
  const switchTop = String(unit * 12);

  return {
    uiConfig: {
      setStatusBarStyle: "1",
      setNavUi: {
        text: "一键登录",
        textColor: "#FFFFFF",
        bgColor: "#FFFFFF",
        bottomBgColor: "#FFFFFF",
        returnImgPath: "static/nav_back.png",
        returnImgWidth: "24",
        returnImgHeight: "24",
      },
      //授权页背景相关设置
      setBackgroundUi: {
        backgroundColor: "#FFFFFF", //授权页背景色，如果是弹窗的话就是弹窗部分的背景色（ps：在加载图片或者视频时，可以设置跟第一帧接近的背景色，这样可以避免在资源加载期间出现白屏效果）
      },
      setLogoUi: {
        imgPath: "static/yjdl.png",
        top: logoTop,
      },
      setSloganUi: {
        top: sloganTop,
        text: "กล่องตาบอด Hip Hop", //slogan标题，不设置则使用默认文案
      },
      setNumberUi: {
        top: numberTop,
      },
      setLoginBtnUi: {
        top: loginBtnTop,
        textColor: "#ffffff",
        color: "#2c2c2c",
      },
      setCheckBoxUi: {
        top: 10,
      },
      setSwitchUi: {
        textColor: "#0faeff",
        top: switchTop,
      },
      setPrivacyUi: {
        expandAuthPageCheckedScope: true,
        bottom: "100",
        alignment: "1",
      },
      setAppPrivacyOne: {
        title: "用户协议",
        url: "https://sjmanghe.com/yhxy.html",
      },
      setAppPrivacyTwo: {
        title: "隐私政策",
        url: "https://sjmanghe.com/ysxy.html",
      },
    },
  };
}

module.exports = {
  buildFullscreen: buildFullscreen,
};
